<template>
	<div class="rankJs w944">
		<div class="label_top">
			<button @click="reBack"><i><&nbsp;</i>返回</button>
			<p>讲师榜</p>
		</div>
		<div class="label_table">
			<div class="el-tabs-report"> 
				<div class="msearch">
					<input placeholder="请输入讲师关键词……" v-model="search"/>
					<a @click="getTableList"><img src="../../assets/qudaoImg/search.png"/></a>
				</div>
           </div>
			<el-table ref="multipleTable" :data="tableData" border>
				<el-table-column label="排名" width="55">
					<template slot-scope="scope">{{ scope.row.sort}}</template>
				</el-table-column>
				<el-table-column prop="nickname" label="讲师"></el-table-column>
				<el-table-column label="性别">
					<template slot-scope="scope">
						<span v-if="scope.row.sex==false">女</span>
						<span v-if="scope.row.sex==true">男</span>
					</template>
				</el-table-column>
				<el-table-column label="课程列表">
					<template slot-scope="scope">
						<el-button @click="studyList(scope.row)">课程列表</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="phone" label="联系电话"></el-table-column>
			</el-table>
			<div class="fenyeMargin">
				<div class="pag_block">
					<el-pagination @current-change="handleCurrentChange" :current-page="currentpage" :page-size="pagesize" layout="prev, pager, next" :total="total"></el-pagination>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				search:'',
				tableData: [],
		        pagesize: 15,
		        currentpage: 1,
		        total: 1
			}
		},
		methods: {
			getTableList() {
				this.$ajax({
					url: this.$root.jifuUrl + "/lecturerRankingList?" + 'page=' + this.currentpage + '&num=' + this.pagesize+ '&name=' + this.search+'&rootcompanyid=1',
					method: 'GET',
					data: {},
					success: res => {
						if(res.data.code == 200) {
							this.tableData = res.data.data.list;
							this.total = res.data.data.pageParam.items;
						}
					}
				});
			},
			studyList(row){
				this.$router.push({
					name: 'tCourseList',
					params: {
						speakerId: row.id, 
						updateTitle:row.nickname+'讲师的课程列表',
						nowBack:2 // 1为讲师管理  2为讲师榜
					}
				})
			},
			reBack(){
				this.$router.go(-1);
			},
		    handleCurrentChange (value) {
		        this.currentpage = value;
		        this.getTableList();
		    }
		},
		mounted: function() {
			this.getTableList();
		}
	}
</script>